package com.room.search.service;

import com.room.search.domain.RoomTransactionProperty;
import com.room.search.repository.RoomTransactionPropertyRepository;
import com.room.search.repository.search.RoomTransactionPropertySearchRepository;
import com.room.search.service.dto.RoomTransactionPropertyDTO;
import com.room.search.service.mapper.RoomTransactionPropertyMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Service Implementation for managing {@link RoomTransactionProperty}.
 */
@Service
@Transactional
public class RoomTransactionPropertyService {

    private final Logger log = LoggerFactory.getLogger(RoomTransactionPropertyService.class);

    private final RoomTransactionPropertyRepository roomTransactionPropertyRepository;
    private final RoomTransactionPropertyMapper roomTransactionPropertyMapper;

    public RoomTransactionPropertyService(RoomTransactionPropertyRepository roomTransactionPropertyRepository,
                                          RoomTransactionPropertyMapper roomTransactionPropertyMapper) {
        this.roomTransactionPropertyRepository = roomTransactionPropertyRepository;
        this.roomTransactionPropertyMapper = roomTransactionPropertyMapper;
    }


    @Transactional
    public RoomTransactionProperty save(RoomTransactionPropertyDTO transactionProperty) {
        log.info("保存房源的交易熟悉：{}", transactionProperty);
        RoomTransactionProperty property = roomTransactionPropertyMapper.toEntity(transactionProperty);
        return roomTransactionPropertyRepository.save(property);
    }

}
